#include <bits/stdc++.h>
using namespace std;

const int MAXN = 1e5 + 10;
int n, r[MAXN];
int t[MAXN], t1[MAXN];
map<int, int> mp;
int cnt;

int main()
{
  freopen("duel.in", "r", stdin);
  freopen("duel.out", "w", stdout);
  scanf("%d", &n);
  for (int i = 1; i <= n; i++)
    scanf("%d", r + i), mp[r[i]] = 0;
  for (auto &&i : mp)
    i.second = ++cnt;
  for (int i = 1; i <= n; i++)
    t[mp[r[i]]]++, t1[mp[r[i]]]++;
  for (int i = 2; i <= cnt; i++)
  {
    int pre = i - 1, cur = t[i];
    while (cur && pre)
    {
      while (!t1[pre] && pre)
        pre--;
      if (pre)
      {
        if (t[pre])
        {
          int x = min({cur, t[pre], t1[pre]});
          cur -= x, t[pre] -= x, t1[pre] -= x;
        }
        else
        {
          int x = min(cur, t1[pre]);
          cur -= x, t1[pre] -= x;
        }
      }
    }
    t[i] = cur;
  }
  int ans = 0;
  for (int i = 1; i <= cnt; i++)
    ans += t1[i];
  printf("%d\n", ans);
  fclose(stdin);
  fclose(stdout);
  return 0;
}